package org.macpro.alone.web.action;

import java.util.List;

import org.macpro.alone.prisist.domain.AloneUser;
import org.macpro.alone.server.common.database.DataComplexQueryManagerInter;
import org.macpro.alone.server.domain.PageDomain;
import org.macpro.alone.server.domain.SqlDomain;
import org.macpro.alone.server.domain.SqlDomain.LimitDomain;
import org.macpro.alone.server.framework.base.AloneBeanFactory;
import org.macpro.alone.server.util.SqlDomainHandle;

import com.opensymphony.xwork2.ActionSupport;

public class Action_UserQuery extends ActionSupport implements
		ActionAloneQueryInter {
	private static final long serialVersionUID = 1L;
	private static DataComplexQueryManagerInter dqm = (DataComplexQueryManagerInter) AloneBeanFactory
	.getBean("COMPLET_QUERY_ALONE_COMMON");
	
	
	private PageDomain pagedomain;//结果集合
	private String currentPage;//当前页
	private String sortTitle;//排序字段
	private String sortType;//排序类型
	private String limitField;//查询条件
	

	@Override
	public String queryall() {
		// TODO Auto-generated method stub
		sortTitle=SqlDomain.initSortTitle(sortTitle);
		currentPage=PageDomain.initCurrentPage(currentPage);
		sortType=SqlDomain.initsortType(sortType);
		PageDomain page=new PageDomain(Integer.valueOf(currentPage));
		List<LimitDomain> limitList=SqlDomainHandle.getLimitDomainForString(limitField);
		SqlDomain sqldomain=new SqlDomain("alone_user",sortTitle,sortType,limitList);
		pagedomain=dqm.runComplexQuery(page, new  AloneUser(),sqldomain );
		return SUCCESS;
	}
	
	@Override
	public String removecommit() {
		return null;
	}
	public String getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(String currentPage) {
		this.currentPage = currentPage;
	}
	public String getSortTitle() {
		return sortTitle;
	}
	public void setSortTitle(String sortTitle) {
		this.sortTitle = sortTitle;
	}
	public String getSortType() {
		return sortType;
	}
	public void setSortType(String sortType) {
		this.sortType = sortType;
	}
	public PageDomain getPagedomain() {
		return pagedomain;
	}
	public void setPagedomain(PageDomain pagedomain) {
		this.pagedomain = pagedomain;
	}
	public String getLimitField() {
		return limitField;
	}
	public void setLimitField(String limitField) {
		this.limitField = limitField;
	}
}
